package com.tc.vms.producer;

/**
 * Created by yonghua.zhang on 2015/12/7.
 */
public enum SendMode {
    SYNC(0, "sync"),
    ASYNC(1, "async"),
    ONEWAY(-1, "async_ow");

    private int mode;
    private String name;

    SendMode(int mode, String name) {
        this.mode = mode;
        this.name = name;
    }

    public int getMode() {
        return mode;
    }

    public String getName() {
        return name;
    }

    public String getNameByIdx(int idx) {
        for (SendMode sm : SendMode.values()) {
            if (idx == sm.getMode()) {
                return sm.getName();
            }
        }
        return null;
    }
}
